package org.ykh.gmall.web.all.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.ykh.gmall.feign.item.clinet.ItemFeignClient;
import org.ykh.gmall.result.Result;

import java.util.Map;

@Controller
@SuppressWarnings("all")
public class ItemController {

    @Autowired
    private ItemFeignClient itemFeignClient;

    /**
     * 商品详情页
     * @param skuId
     * @param model
     * @return
     */
    @GetMapping("/{skuId}.html")
    public String item(@PathVariable Long skuId, Model model){
        Result<Map<String,Object>> result = itemFeignClient.item(skuId);
        model.addAllAttributes(result.getData());
        return "item/item";
    }


}
